package chenxi.proxy;

import com.google.common.reflect.Reflection;

/**
 * @author bowen
 */
public class ProxyTest {

    public static void main(String[] args) {
        UserServiceImpl userServiceImpl = new UserServiceImpl();
        UserService userServiceCglib = (UserService) new CglibProxyHandler().newProxy(userServiceImpl);
        userServiceCglib.save("bowen", "bowen1902");

        UserService userServiceJdk = Reflection.newProxy(UserService.class, new JdkProxyHandler(userServiceImpl));
        userServiceJdk.save("bowen", "bowen1902");
    }
}
